home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _3283400E7B534FF1B2A0E0AA2029DF74 < prev    next >
Encoding:
Text File  |  2002-06-05  |  5.2 KB  |  127 lines

  1. // Copyright (C) 2001-2002 Raven Software
  2. //
  3.  
  4. /*****************************************************************************
  5.  * name:        be_ai_move.h
  6.  *
  7.  * desc:        movement AI
  8.  *
  9.  * $Archive: /source/code/botlib/be_ai_move.h $
  10.  * $Author: Mrelusive $ 
  11.  * $Revision: 2 $
  12.  * $Modtime: 10/05/99 3:32p $
  13.  * $Date: 10/05/99 3:42p $
  14.  *
  15.  *****************************************************************************/
  16.  
  17. //movement types
  18. #define MOVE_WALK                        1
  19. #define MOVE_CROUCH                        2
  20. #define MOVE_JUMP                        4
  21. #define MOVE_GRAPPLE                    8
  22. #define MOVE_ROCKETJUMP                    16
  23. #define MOVE_BFGJUMP                    32
  24. //move flags
  25. #define MFL_BARRIERJUMP                    1        //bot is performing a barrier jump
  26. #define MFL_ONGROUND                    2        //bot is in the ground
  27. #define MFL_SWIMMING                    4        //bot is swimming
  28. #define MFL_AGAINSTLADDER                8        //bot is against a ladder
  29. #define MFL_WATERJUMP                    16        //bot is waterjumping
  30. #define MFL_TELEPORTED                    32        //bot is being teleported
  31. #define MFL_GRAPPLEPULL                    64        //bot is being pulled by the grapple
  32. #define MFL_ACTIVEGRAPPLE                128        //bot is using the grapple hook
  33. #define MFL_GRAPPLERESET                256        //bot has reset the grapple
  34. #define MFL_WALK                        512        //bot should walk slowly
  35. // move result flags
  36. #define MOVERESULT_MOVEMENTVIEW            1        //bot uses view for movement
  37. #define MOVERESULT_SWIMVIEW                2        //bot uses view for swimming
  38. #define MOVERESULT_WAITING                4        //bot is waiting for something
  39. #define MOVERESULT_MOVEMENTVIEWSET        8        //bot has set the view in movement code
  40. #define MOVERESULT_MOVEMENTWEAPON        16        //bot uses weapon for movement
  41. #define MOVERESULT_ONTOPOFOBSTACLE        32        //bot is ontop of obstacle
  42. #define MOVERESULT_ONTOPOF_FUNCBOB        64        //bot is ontop of a func_bobbing
  43. #define MOVERESULT_ONTOPOF_ELEVATOR        128        //bot is ontop of an elevator (func_plat)
  44. #define MOVERESULT_BLOCKEDBYAVOIDSPOT    256        //bot is blocked by an avoid spot
  45. //
  46. #define MAX_AVOIDREACH                    1
  47. #define MAX_AVOIDSPOTS                    32
  48. // avoid spot types
  49. #define AVOID_CLEAR                        0        //clear all avoid spots
  50. #define AVOID_ALWAYS                    1        //avoid always
  51. #define AVOID_DONTBLOCK                    2        //never totally block
  52. // restult types
  53. #define RESULTTYPE_ELEVATORUP            1        //elevator is up
  54. #define RESULTTYPE_WAITFORFUNCBOBBING    2        //waiting for func bobbing to arrive
  55. #define RESULTTYPE_BADGRAPPLEPATH        4        //grapple path is obstructed
  56. #define RESULTTYPE_INSOLIDAREA            8        //stuck in solid area, this is bad
  57.  
  58. //structure used to initialize the movement state
  59. //the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate
  60. typedef struct bot_initmove_s
  61. {
  62.     vec3_t origin;                //origin of the bot
  63.     vec3_t velocity;            //velocity of the bot
  64.     vec3_t viewoffset;            //view offset
  65.     int entitynum;                //entity number of the bot
  66.     int client;                    //client number of the bot
  67.     float thinktime;            //time the bot thinks
  68.     int presencetype;            //presencetype of the bot
  69.     vec3_t viewangles;            //view angles of the bot
  70.     int or_moveflags;            //values ored to the movement flags
  71. } bot_initmove_t;
  72.  
  73. //NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set
  74. typedef struct bot_moveresult_s
  75. {
  76.     int failure;                //true if movement failed all together
  77.     int type;                    //failure or blocked type
  78.     int blocked;                //true if blocked by an entity
  79.     int blockentity;            //entity blocking the bot
  80.     int traveltype;                //last executed travel type
  81.     int flags;                    //result flags
  82.     int weapon;                    //weapon used for movement
  83.     vec3_t movedir;                //movement direction
  84.     vec3_t ideal_viewangles;    //ideal viewangles for the movement
  85. } bot_moveresult_t;
  86.  
  87. // bk001204: from code/botlib/be_ai_move.c
  88. // TTimo 04/12/2001 was moved here to avoid dup defines
  89. typedef struct bot_avoidspot_s
  90. {
  91.     vec3_t origin;
  92.     float radius;
  93.     int type;
  94. } bot_avoidspot_t;
  95.  
  96. //resets the whole move state
  97. void BotResetMoveState(int movestate);
  98. //moves the bot to the given goal
  99. void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, int travelflags);
  100. //moves the bot in the specified direction using the specified type of movement
  101. int BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
  102. //reset avoid reachability
  103. void BotResetAvoidReach(int movestate);
  104. //resets the last avoid reachability
  105. void BotResetLastAvoidReach(int movestate);
  106. //returns a reachability area if the origin is in one
  107. int BotReachabilityArea(vec3_t origin, int client);
  108. //view target based on movement
  109. int BotMovementViewTarget(int movestate, bot_goal_t *goal, int travelflags, float lookahead, vec3_t target);
  110. //predict the position of a player based on movement towards a goal
  111. int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t *goal, int travelflags, vec3_t target);
  112. //returns the handle of a newly allocated movestate
  113. int BotAllocMoveState(void);
  114. //frees the movestate with the given handle
  115. void BotFreeMoveState(int handle);
  116. //initialize movement state before performing any movement
  117. void BotInitMoveState(int handle, bot_initmove_t *initmove);
  118. //add a spot to avoid (if type == AVOID_CLEAR all spots are removed)
  119. void BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
  120. //must be called every map change
  121. void BotSetBrushModelTypes(void);
  122. //setup movement AI
  123. int BotSetupMoveAI(void);
  124. //shutdown movement AI
  125. void BotShutdownMoveAI(void);
  126.  
  127.